<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<h:outputStylesheet name="common-style.css" library="css" />
	<title>Danh sách HĐ vay chờ xử lý</title>
	<link rel="shortcut icon" type="image/x-icon"
		href="#{request.contextPath}/resources/images/favicon.ico" />
</h:head>
<h:body style="font-size: 11px;">
	<p:layout style="height:800px;width:1200px; margin:0 auto;" id="layout">
		<p:layoutUnit position="center">
			<p:graphicImage value="/resources/images/MDB.jpg" width="250"
				height="90" />

			<p:ajaxStatus onstart="modalDialogTest.show();"
				onsuccess="modalDialogTest.hide();" />
			<p:dialog id="modalDialog" showHeader="false" closable="true"
				widgetVar="modalDialogTest" modal="true">
				<p:graphicImage value="/resources/images/482.GIF" />
			</p:dialog>
			<h:form id="frmMainLoans">
				<ui:insert name="menu">
					<ui:include src="/admin/menu.xhtml" />
				</ui:insert>
				<p:panel
					header="TRANG QUẢN TRỊ HỆ THỐNG KHUYẾN MÃI 'ĐẮC LỘC TÂN XUÂN'">
					<p:growl id="growl_ID" showDetail="true" sticky="true" />
					<p:dataTable id="dtbLoansInfo" var="LOAN"
						value="#{loansPendingBean.loansDataModel}"
						selection="#{loansPendingBean.loansSelected}"
						selectionMode="single" sortMode="multiple"
						emptyMessage="Không có dữ liệu" paginator="true" rows="15"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="10,15,20" paginatorPosition="bottom">
						<f:facet name="header">
							<h:outputText value="DANH SÁCH HỢP ĐỒNG VAY CHỜ CẤP MÃ DỰ THƯỞNG"
								style="float:left;" />
						</f:facet>
						<p:column headerText="STT">
							<h:outputText
								value="#{loansPendingBean.loansDataModel.rowIndex + 1}"
								styleClass="textBold" />
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="CHI NHÁNH" />
							</f:facet>
							<h:outputText value="#{LOAN.branchCode}" styleClass="textBold" />
						</p:column>

						<p:column sortBy="#{LOAN.processDate}" headerText="NGÀY XỬ LÝ">
							<h:outputText value="#{LOAN.processDate}" styleClass="textBold">
								<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
							</h:outputText>
						</p:column>

						<p:column>
							<f:facet name="header">
								<h:outputText value="SỔ HỢP ĐỒNG" />
							</f:facet>
							<h:outputText value="#{LOAN.refNo}" styleClass="textBold" />
						</p:column>

						<p:column>
							<f:facet name="header">
								<h:outputText value="TÊN KHÁCH HÀNG" />
							</f:facet>
							<h:outputText value="#{LOAN.customerName}" styleClass="textBold" />
						</p:column>

						<p:column sortBy="#{LOAN.term}">
							<f:facet name="header">
								<h:outputText value="KỲ HẠN" />
							</f:facet>
							<h:outputText value="#{LOAN.term}" styleClass="textBold" />
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="NGÀY HIỆU LỰC" />
							</f:facet>
							<h:outputText value="#{LOAN.valueDate}" styleClass="textBold">
								<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
							</h:outputText>
						</p:column>

						<p:column sortBy="#{LOAN.prAmount}">
							<f:facet name="header">
								<h:outputText value="SỐ TIỀN GIẢI NGÂN(VND)" />
							</f:facet>
							<h:outputText value="#{LOAN.prAmount}" styleClass="textBold">
								<f:convertNumber locale="en" pattern="#,##0.00;(#,##0.00)" />
							</h:outputText>
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="LOẠI HÌNH VAY" />
							</f:facet>
							<h:outputText value="#{LOAN.category}" styleClass="textBold" />
						</p:column>
						<p:column>
							<f:facet name="header">
								<h:outputText value="DỰ THƯỞNG" />
							</f:facet>
							<h:outputText value="#{LOAN.lkdNum}" styleClass="textBold" />
						</p:column>
						<f:facet name="footer">
							<p:inputText style="float:left;height:18px;"
								value="#{loansPendingBean.createdBy}" />
							<p:commandButton value="Tạo mã dự thưởng"
								action="#{loansPendingBean.generateLuckyDrawForLoans}"
								update=":frmMainLoans:growl_ID,dtbLoansInfo,:frmMainLoans:pngDateProcess,:frmMainLoans:pngDateHistory"
								disabled="#{loansPendingBean.btnEnableGenerate == false}"
								icon="ui-icon-shuffle" style="float:left;margin:0 auto;" />
						</f:facet>
					</p:dataTable>
					<h:panelGrid columns="4" id="pngDateProcess">
						<h:outputText value="Ngày vừa xử lý: " />
						<h:outputText value="#{loansPendingBean.lastUpdated}"
							style="color:red;">
							<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
						</h:outputText>
						<h:outputText value="Ngày xử lý tiếp theo: " />
						<h:outputText value="#{loansPendingBean.nextProcess}"
							style="color:red;">
							<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
						</h:outputText>
					</h:panelGrid>
					<h:panelGrid columns="2" id="pngDateHistory">
						<p:dataList value="#{loansPendingBean.datesUpdated}" var="dte">
						<h:outputText value = "Đã xử lý: "/>
							<h:outputText value="#{dte}" style="color:red;">
								<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
							</h:outputText>
						</p:dataList>

					</h:panelGrid>
				</p:panel>
			</h:form>
		</p:layoutUnit>
		<h:outputText
			value="Bản quyền &#169; 2013 Ngân hàng TMCP Phát Triển Mê Kông. Xây dựng bởi Đỗ Đức Tú."
			style="font-style:italic;" />
	</p:layout>
</h:body>
</html>